<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<link href="<%=path%>/CSS/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=path%>/JQuery/jquery-1.8.2.js"></script>
<%@ include file="/WEB-INF/JSP/ajax.jsp"%>
<script type="text/javascript"
	src="<%=path%>/My97DatePicker/WdatePicker.js"></script>
<style type="text/css">
.seachform li label {line-height: 45px;color: #444444}
.scinput {line-height: 10px;margin-top: 5px}
.scinput1 {margin-top: 5px;height: 30px;}
.scbtn {background: #57a0ff;border-radius: 20px;width: 110px;margin-top: 4px;height: 35px}
thead {background: #f2f2f2}
.tablelist2 th {height: 45px;background: none;}
.tablelist2 tr{height:45px;}
.tablelist2 tr th{height: 20px;border-left: 1px solid #dddee6;border-right: 1px solid #dddee6;color: #444444;text-align: center;}
.tou{background: #e4eafe}
.kh{border-bottom: 1px solid #dddee6;}
.shuju td{border-left: 1px solid #dddee6;border-right: 1px solid #dddee6;color: #787c88;text-align: center;}
.shuju:nth-child(odd){background: #ffffff}
.shuju:nth-child(even){background: #f3f5fb}
.shuju:last-child{border-bottom: 1px solid #dddee6;}
.shuju:HOVER {
	background: #fff6cd;
}
 .loading {
            margin: 200px 600px;
            display: block;
            width: 65px;
            height: 65px;
            border: 1px solid #ddd;
            border-radius: 5px;
            opacity: .7;
	 background: url(<%=path%>/images/loading.gif) no-repeat;
        }
.xuhao{width: 60px}
.name{width: 60px}
.sfzh{width: 100px}
.jzlx{width: 36px}
.rq{width: 60px}
.fy{width: 40px}
.sfk{width: 120px}
.bz{width: 100px;}

.scbtn {
	outline: none;
}
</style>
</head>
<body style="background: #f5f5f5;padding: 0 10px;">
	<div class="place" style="background: #f5f5f5; margin-top: 10px">
		<ul class="placeul">
			<li><a href="#">报表</a></li>
			<li><a href="#">财务报表</a></li>
			<li><a href="<%=path%>/DrivingSys/queryTrainDetail/look.action">培训收退费明细表</a></li>
		</ul>
	</div>

	<div class="rightinfo"
		style="background: #fff; border-radius: 10px; height: 45px;">

		<form action="<%=path%>/DrivingSys/outXls" class="form" method="post" >
			<ul class="seachform">
				<li><label>开始时间</label><input class="scinput1" name="beginTime"
					type="text"
					onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}',dateFmt:'yyyy-MM-dd'})"
					id="datemin" class="input-text Wdate" style="width: 150px;"
					value="${beginTime}"></li>
				<li><label>结束时间</label><input class="scinput1" name="endTime"
					type="text"
					onfocus="WdatePicker({minDate:'#F{$dp.$D(\'datemin\')}',maxDate:'%y-%M-%d',dateFmt:'yyyy-MM-dd'})"
					id="datemax" class="input-text Wdate" style="width: 150px;"
					value="${endTime}">
				    <input type="hidden" name="xls" id="xls" value="">
					<input type="hidden" name="fileNames" value="驾校学员收费、退费明细表">
					<input type="hidden" id="stu">					
			  </li>
				<li><label>&nbsp;</label><input name="" type="button"
												class="scbtn" value="立即查询" id="cx"/></li>
				<shiro:hasPermission name="/outXlsTrainDetail">
					<li><label>&nbsp;</label><input onclick="chargeCss()" type="submit" id="dc"
													class="scbtn" value="导出Excel" /></li>
				</shiro:hasPermission>
			</ul>
		</form>
	</div>

	<div style="width: 100%; overflow: auto; margin-bottom: 20px; margin-top: 30px; background: #fff; box-shadow: 0 0 10px #f2f2f2; min-height: 600px" class="div">
		<table class="tablelist2" style="width: 120%;white-space:nowrap;"id="table1">
			<!--  <tr class="tou">
				<th rowspan="2" class="xuhao">报名序号</th>
				<th rowspan="2" class="name">姓名</th>
				<th rowspan="2" class="sfzh">身份证号</th>
				<th rowspan="2" class="jzlx">驾照类型</th>
				<th rowspan="2" class="rq">缴费日期</th>
				<th rowspan="2" class="rq">开票日期</th>
				<th colspan="3" class="kh sfk">收款方式及金额</th>
				<th rowspan="2" class="fy">培训费</th>
				<th rowspan="2" class="fy">规费</th>
				<th rowspan="2" class="fy">培训计时卡</th>
				<th rowspan="2" class="fy">照相</th>
				<th colspan="2" class="kh">考前训练收费</th>
				<th rowspan="2" class="fy">其他</th>
				<th rowspan="2" class="fy">合计</th>
				<th rowspan="2" class="fy">欠费</th>
				<th colspan="2" class="kh">推荐人</th>
				<th colspan="4" class="kh">规费</th>
				<th colspan="3" class="kh">退费</th>
				<th colspan="5" class="kh">扣款</th>
				<th rowspan="2" class="fy">实退金额</th>
				<th rowspan="2" class="bz">备注</th>
			</tr>
			<tr class="tou">
				<th class="fy">刷卡</th>
				<th class="fy">现金</th>
				<th class="fy">合计</th>
				<th class="fy">科二</th>
				<th class="fy">科三</th>
				<th class="name">部门</th>
				<th class="name">姓名</th>
				<th class="name">发票时间</th>
				<th class="name">发票号码</th>
				<th class="name">付款时间</th>
				<th class="name">上缴金额</th>
				<th class="fy">培训费</th>
				<th class="fy">退规费</th>
				<th class="fy">培训计时卡</th>
				<th class="fy">退费手续费</th>
				<th class="fy">刷卡手续费</th>
				<th class="fy">教材费</th>
				<th class="fy">培训计时卡</th>
				<th class="fy">其他</th>
			</tr> -->
			
		</table>
	</div>
	<div id="hidden" style="display: none">
	
	</div>
</body>
<script type="text/javascript">
$(document).ready(function(){
	var beginTime = "${beginTime}"
	var endTime = "${endTime}"
	$('#table1').html("<tr><td class='loading'></td></tr>");
	var str = ''
	str += '<tr class="tou tou2" style="display: none;"><th colspan="34" style="height:40px">培训收、退费明细表</th></tr>'
	str += '<tr class="tou tou2" style="display: none">'
	for(var a = 0;a<28;a++){
		str += '<th></th>'
	}
	str += '<th colspan="4" style="height:30px">时间：'+beginTime+'至'+endTime+'</th><th colspan="2">单位：元</th></tr>'
	str += '<tr class="tou"><th rowspan="2" class="xuhao" style="height:30px">报名序号</th><th rowspan="2" class="name">姓名</th>'
	str += '<th rowspan="2" class="sfzh">身份证号</th><th rowspan="2" class="jzlx">驾照类型</th><th rowspan="2" class="rq">缴费日期</th>'
	str += '<th rowspan="2" class="rq">开票日期</th><th colspan="3" class="kh sfk" id="yellow" style="height:15px">收款方式及金额</th><th rowspan="2" class="fy zise">培训费</th>'
	str += '<th rowspan="2" class="fy zise">规费</th><th rowspan="2" class="fy zise">培训计时卡</th><th rowspan="2" class="fy zise">照相</th>'
	str += '<th colspan="2" class="kh zise">考前训练收费</th><th rowspan="2" class="fy zise">其他</th><th rowspan="2" class="fy zise">合计</th>'	 
	str += '<th rowspan="2" class="fy zise">欠费</th><th colspan="2" class="kh">推荐人</th><th colspan="4" class="kh qingse">规费</th><th colspan="3" class="kh fenhong">退费</th>'
	str += '<th colspan="5" class="kh fenhong">扣款</th><th rowspan="2" class="fy qingse">实退金额</th><th rowspan="2" class="bz">备注</th></tr>'
	str += '<tr class="tou"><th class="fy yellow">刷卡</th><th class="fy yellow">现金</th><th class="fy yellow">合计</th><th class="fy zise">科二</th>'
	str += '<th class="fy zise">科三</th><th class="name">部门</th><th class="name">姓名</th><th class="name qingse">发票时间</th><th class="name qingse">发票号码</th>'
	str += '<th class="name qingse">付款时间</th><th class="name qingse">上缴金额</th><th class="fy fenhong">培训费</th><th class="fy fenhong">退规费</th><th class="fy fenhong">培训计时卡</th>'
	str += '<th class="fy fenhong">退费手续费</th><th class="fy fenhong">刷卡手续费</th><th class="fy fenhong">教材费</th><th class="fy fenhong">培训计时卡</th><th class="fy fenhong">其他</th></tr>'
	$.ajax({
		url: '<%=path%>/DrivingSys/queryDetailDataByTime',
        type: "post",
        data: {'startTime':beginTime,'endTime':endTime},
        dataType: "json",
        async: true,
        success:function(json){
        		data(json,str)
        },
        error:function(){
        	$(".loading").remove();
        	alert("错误")
        }
	})
})


//改变样式
function chargeCss(){
	$("#hidden").html($(".div").html())
	$("#hidden table .tou th:nth-child(2)").css("width","15px");
	$("#hidden table .tou th:nth-child(1)").css("width","16px");
	$("#hidden table .tou th:nth-child(0)").css("width","16px");
	$("#hidden table .tou th").css("text-align","center");
	
	$("#hidden #other").css("width","15px")
	$("#hidden #ze").css("width","14px")
	$("#hidden #qf").css("width","18px")
	
	$("#hidden .shuju td:odd").css("text-align","center");
	$("#hidden .shuju td:even").css("text-align","center");
	
	//$("#hidden .shuju td:last").css("height","23px");
	//$("#hidden #hjshuju td").css("background","rgb(255,193,133)");
	
	//$("#hidden table #yellow").css("background","yellow");
	
	$("#hidden table tr th").css("font-weight","bold"); 
	$("#hidden .shuju td").css("font-size","11pt");
	$("#hidden .tou th").css("font-size","11pt");
	
	$("#hidden .tou2 th").css("background","rgb(228,234,254)");
	$("#hidden  .yellow").css("background","yellow");//黄色
	$("#hidden  #yellow").css("background","yellow");//黄色
	$("#hidden  .zise").css("background","rgb(132,112,255)");//紫色
	$("#hidden  .qingse").css("background","rgb(0,250,154)");//青色
	$("#hidden  .fenhong").css("background","rgb(219,112,147)");
	$("#xls").val($("#hidden").html())
}



//根据时间查询
$("#cx").click(function(){
	var startTime = $("#datemin").val();
	var endTime = $("#datemax").val();
	if(startTime == null || startTime == ''){
		alert("开始时间不能未空")
		return false
	}
	if(endTime == null || endTime == ''){
		alert("结束时间不能未空")
		return false
	}
	$('#table1').html("<tr><td class='loading'></td></tr>");
	var str = ''
		str += '<tr class="tou tou2" style="display: none;"><th colspan="34" style="height:40px">培训收、退费明细表</th></tr>'
		str += '<tr class="tou tou2" style="display: none">'
		for(var a = 0;a<28;a++){
			str += '<th></th>'
		}
		str += '<th colspan="4" style="height:30px">时间：'+startTime+'至'+endTime+'</th><th colspan="2">单位：元</th></tr>'
		str += '<tr class="tou"><th rowspan="2" class="xuhao" style="height:30px">报名序号</th><th rowspan="2" class="name">姓名</th>'
		str += '<th rowspan="2" class="sfzh">身份证号</th><th rowspan="2" class="jzlx">驾照类型</th><th rowspan="2" class="rq">缴费日期</th>'
		str += '<th rowspan="2" class="rq">开票日期</th><th colspan="3" class="kh sfk" id="yellow" style="height:15px">收款方式及金额</th><th rowspan="2" class="fy zise">培训费</th>'
		str += '<th rowspan="2" class="fy zise">规费</th><th rowspan="2" class="fy zise">培训计时卡</th><th rowspan="2" class="fy zise">照相</th>'
		str += '<th colspan="2" class="kh zise">考前训练收费</th><th rowspan="2" class="fy zise">其他</th><th rowspan="2" class="fy zise">合计</th>'	 
		str += '<th rowspan="2" class="fy zise">欠费</th><th colspan="2" class="kh">推荐人</th><th colspan="4" class="kh qingse">规费</th><th colspan="3" class="kh fenhong">退费</th>'
		str += '<th colspan="5" class="kh fenhong">扣款</th><th rowspan="2" class="fy qingse">实退金额</th><th rowspan="2" class="bz">备注</th></tr>'
		str += '<tr class="tou"><th class="fy yellow">刷卡</th><th class="fy yellow">现金</th><th class="fy yellow">合计</th><th class="fy zise">科二</th>'
		str += '<th class="fy zise">科三</th><th class="name">部门</th><th class="name">姓名</th><th class="name qingse">发票时间</th><th class="name qingse">发票号码</th>'
		str += '<th class="name qingse">付款时间</th><th class="name qingse">上缴金额</th><th class="fy fenhong">培训费</th><th class="fy fenhong">退规费</th><th class="fy fenhong">培训计时卡</th>'
		str += '<th class="fy fenhong">退费手续费</th><th class="fy fenhong">刷卡手续费</th><th class="fy fenhong">教材费</th><th class="fy fenhong">培训计时卡</th><th class="fy fenhong">其他</th></tr>'
	$.ajax({
		url: '<%=path%>/DrivingSys/queryDetailDataByTime',
        type: "post",
        data: {'startTime':startTime,'endTime':endTime},
        dataType: "json",
        async: true,
        success:function(json){
        	data(json,str)
        },
        error:function(){
        	$(".loading").remove();
        	alert("错误")
        }
	})
})
//放入数据
function data(json,str){
	if(json == null){
		
	}else{
		for(var i=0;i<json.length;i++){
			var skhj = 0;
			var hj = 0;
			str += '<tr class="shuju">'
			if(json[i].fnumber == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].fnumber+'</td>'
			}
			str += '<td>'+json[i].name+'</td>'
			str += '<td>'+json[i].cfidcardno+'</td>'
            if (json[i].sqlx == null) {
                str += '<td></td>'
            } else {
                str += '<td>' + json[i].sqlx + '</td>'
            }
			if(json[i].jfrq == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].jfrq+'</td>'
			}
			str += '<td></td>'
			if(json[i].card == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].card+'</td>'
				skhj = skhj + json[i].card*1
			}
			if(json[i].cash == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].cash+'</td>'
				skhj = skhj + json[i].cash*1
			}
			str += '<td class="yellow">'+skhj+'</td>'
			if(json[i].pxf == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].pxf+'</td>'
				hj = hj + json[i].pxf*1
			}
			if(json[i].gf == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].gf+'</td>'
				hj = hj + json[i].gf*1
			}
			if(json[i].pxjsk == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].pxjsk+'</td>'
				hj = hj + json[i].pxjsk*1
			}
			if(json[i].zx == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].zx+'</td>'
				hj = hj + json[i].zx*1
			}
			if(json[i].ke == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].ke+'</td>'
				hj = hj + json[i].ke*1
			}
			if(json[i].ks == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].ks+'</td>'
				hj = hj + json[i].ks*1
			}
			if(json[i].other == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].other+'</td>'
				hj = hj + json[i].other*1
			}
			str += '<td class="zise">'+hj+'</td>'
			if(json[i].qf == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].qf+'</td>'
			}
			if(json[i].dept == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].dept+'</td>'
			}
			if(json[i].tjr == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].tjr+'</td>'
			}
			if(json[i].fpsj == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].fpsj+'</td>'
			}	
			if(json[i].fphm == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].fphm+'</td>'
			}	
			if(json[i].fksj == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].fksj+'</td>'
			}
			if(json[i].sjje == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].sjje+'</td>'
			}
			if(json[i].tfpxf == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].tfpxf+'</td>'
			}
			if(json[i].tgf == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].tgf+'</td>'
			}
			if(json[i].tfpxjsk == null){
				str += '<td></td>'
			}else{
				if(json[i].tfpxjsk == '1'){
					str += '<td>已发放</td>'
				}else{
					str += '<td>未发放</td>'
				}
				
			}
			if(json[i].tfsxf == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].tfsxf+'</td>'
			}
			if(json[i].sksxf == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].sksxf+'</td>'
			}
			if(json[i].jcf == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].jcf+'</td>'
			}
			if(json[i].kkpxjsk == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].kkpxjsk+'</td>'
			}
			if(json[i].kkqt == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].kkqt+'</td>'
			}
			if(json[i].stje == null){
				str += '<td class="qingse"></td>'
			}else{
				str += '<td class="qingse">'+json[i].stje+'</td>'
			}
			if(json[i].cfdesc == null){
				str += '<td></td>'
			}else{
				str += '<td>'+json[i].cfdesc+'</td>'
			}
			str +='</tr>'
		}
		$('#table1').html(str);
	}
}

//num是要处理的数字  v为要保留的小数位数
function decimal(num,v){
	var vv = Math.pow(10,v);
	return Math.round(num*vv)/vv;
}
</script>
</html>